Send Message (Streaming)
Sends a new message to an existing chat and returns a Server-Sent Events stream. Events include the initial assistant-message snapshot, content chunk deltas, final usage, and a closing message snapshot. The response is `text/event-stream`; each event is `data: <JSON>\n\n` where the JSON conforms to MessageStreamEvent.
Usage
import { v0 } from 'v0-sdk'const result = await v0.messages.sendStream({ chatId: 'chat_abc123', message: 'Hello, world!',})console.log(result)API Signature
Request
Path Parameters
The unique identifier of the chat.
Request Body
The prompt or instruction to send to the model.
System-level context for the chat, such as frameworks or development environment details.
Overrides for the model behavior.
Model to use for the generation.
Enables image generations to generate up to 5 images per version.
MCP server IDs to enable. When omitted, uses default enabled servers.
Files or assets to include with the message.
URL of the attachment.
Skill IDs (from skills.sh) to attach. Skills provide domain-specific knowledge to the AI. Maximum 3.
An optional action. Use fix-with-v0 to trigger automatic error fixing — the message should contain the error context.
Response (Stream)
The response is a text/event-stream. Each event is data: <JSON>\n\n where the JSON conforms to one of the following event types:
A single Server-Sent Events payload emitted by the streaming send-message endpoint. Each SSE event is data: <JSON>\n\n where the JSON conforms to one of the union members.
Unique message identifier.
ID of the chat this message belongs to.
Who produced this message.
ISO timestamp when the message was created.
ISO timestamp when the message was last updated.
The trailing prose of the message — the agent’s closing summary, or the user’s message text. Empty string when there is no closing prose.
Ordered list of parts that make up the message. Iterate to render the full narrative including thinking, file operations, tool calls, and prose.
A block of text output by the agent.
Markdown prose written by the agent or user.
ISO timestamp when this part began.
ISO timestamp when this part completed.
Why generation ended. Null while the agent is still generating; once non-null, the message is final and safe to consume.
Files attached to this message.
URL to the attachment.
Original filename, when available.
MIME type.
Size in bytes.
ID of the user who authored a user message; null for assistant messages.
Token usage and credit cost. All values are zero on user messages and on assistant messages that have not yet generated tokens.
Token counts for this message.
Prompt input value (non-cached).
Completion output value.
Cache-read input value.
Cache-write input value.
Sum of input, output, cacheRead, and cacheWrite.
Credit cost for this message.
Prompt input value (non-cached).
Completion output value.
Cache-read input value.
Cache-write input value.
Sum of input, output, cacheRead, and cacheWrite.
Initial and final message-state event. Emitted once at stream open with the freshly-created assistant message (empty parts, null finishReason), and once at stream close with the completed message.
Send Message (Async)
Sends a new message to an existing chat and processes it in the background. Returns immediately with the assistant message ID. Poll GET /chats/:chatId/messages/:messageId and check `finishReason` to detect completion.
Stop Message
Stops an in-flight assistant message generation. The agent aborts at the next safe point and the message is marked finished.